hotfix:fix the terragrunt regex expression - #152
Merged
Conversation
The terragrunt prefix regex used `:\s*` to strip the timestamp+module
prefix from each stdout line. The greedy `\s*` ate not only the single
separator space terragrunt inserts between `tf:` and the wrapped output,
but also the leading 2/4/6/… spaces of `terraform plan`'s own diff
indentation. Result: every `# resource will be created` and `+ field =
…` line in the rendered Change Result block lands at column 0, making
the diff unreadable.
Switch the trailing `:\s*` to `: ?` (optional single space). Now exactly
the separator space is consumed; terraform's indentation survives
intact. Verified end-to-end via the localfile notifier:
before: `+ resource "x" "y" {` (column 0)
after: ` + resource "x" "y" {` (2-space indent preserved)
after: ` + id = (known after apply)` (6-space indent preserved)
Added a regression test that asserts 2- and 6-space indents survive.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…d mode
Terragrunt run-all prefixes each leaf module's stdout with [module/path]
brackets; the root module's lines have no bracket. The previous parser
only matched the bracketed form, so after a leaf's section ended, root
lines were attributed to the prior leaf — e.g. a root IAM change would
show up under cluster-citadel-2g/regions/tokyo/shared-vpc in the
per-module summary.
Add a LogRootModule regex matching unbracketed terragrunt log lines and
flip currentModule back to root ("") when one appears, but only when
the previous module was set by a [bracket] log prefix. Module headers
of the form `Module <path>` (no log prefix) keep working as before —
unbracketed lines that follow them stay attributed to the declared
module.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WHAT
SSIA
(Write the change being made with this pull request)
WHY
The Changed Result in Default template is not being formatted properly.
(Write the motivation why you submit this pull request)